package cn.smxy.admin.util;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Date;

@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface UserLoginToken {
    boolean required() default true;
//    /**
//     * 添加jwt认证，设置token
//     */
//    long currentTime = System.currentTimeMillis() + 60 * 60 * 1000; // 一小时有效时间
//    String token = "";
//    token = JWT.create()
//            .withAudience(String.valueOf(adminUser.getAdminId()))
//            .withIssuedAt(new Date())
//            .withExpiresAt(new Date(currentTime))
//            .withClaim("username",adminUser.getAdminName())
//            .sign(Algorithm.HMAC256(adminUser.getAdminPassword()));
}

